package com.yc.mybatis.mapper;

import com.yc.mybatis.entity.Bill;
import com.yc.mybatis.entity.BillItem;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface BillMapper {
    @Results(
            id="rm1",
            value = {
                    @Result(id=true,column = "id",property = "id"),
                    @Result(column = "id",property = "items",
                    many=@Many(fetchType = FetchType.LAZY,
                    select = "com.yc.mybatis.mapper.BillTtemMaper.selectByBid")),
            }
    )
    @Select("select * from bill where type=#{type}")
    List<Bill> selectByType(String type);
}
